LL_DMA_Init and LL_DMA_DeInit APIs migration ¶
The LL initialization and de-initialization functions previously available in the
stm32tnxx_ll_dma.c
files
within HAL1 are no longer present in HAL2.
In HAL2, all LL C files (
stm32tnxx_ll_dma.c) have been removed, leaving only the LL header files (
stm32tnxx_ll_dma.h)
that contain static inline functions.
If users need to initialize or de-initialize DMA using the LL layer, they have to:
Replace manually the initialization and de-initialization functions: Replace the
LL_DMA_Init
and
LL_DMA_DeInit
functions
manually with equivalent sequences using the static inline functions provided in the
stm32tnxx_ll_dma.h
file,
tailored to their specific configuration and requirements.
This approach ensures that the initialization and de-initialization sequences are precisely addressing the given use case based on the LL static inline functions provided in the
stm32tnxx_ll_dma.h
header file.
The sequences offer improved footprint optimization compared to the previous LL initialization functions found in
stm32tnxx_ll_dma.c.
Related concept: Remove stm32tnxx_ll_ppp.c files
Replace manually the initialization and de-initialization functions ¶
LL_DMA_Init() API migration ¶
According to the use-case, implement the precise sequence call based on the LL static inline functions provided in
the
stm32tnxx_ll_dma.h
header file.
|
HAL1 |
HAL2 |
|---|---|
LL_DMA_InitTypeDef DMA_InitStruct = {0};
DMA_InitStruct.SrcAddress = 0x00000000U;
DMA_InitStruct.DestAddress = 0x00000000U;
DMA_InitStruct.Direction = LL_DMA_DIRECTION_MEMORY_TO_MEMORY;
DMA_InitStruct.BlkHWRequest = LL_DMA_HWREQUEST_SINGLEBURST;
DMA_InitStruct.DataAlignment = LL_DMA_DATA_ALIGN_ZEROPADD;
DMA_InitStruct.SrcBurstLength = 1;
DMA_InitStruct.DestBurstLength = 1;
DMA_InitStruct.SrcDataWidth = LL_DMA_SRC_DATAWIDTH_BYTE;
DMA_InitStruct.DestDataWidth = LL_DMA_DEST_DATAWIDTH_BYTE;
DMA_InitStruct.SrcIncMode = LL_DMA_SRC_FIXED;
DMA_InitStruct.DestIncMode = LL_DMA_DEST_FIXED;
DMA_InitStruct.Priority = LL_DMA_LOW_PRIORITY_LOW_WEIGHT;
DMA_InitStruct.BlkDataLength = 0x00000000U;
DMA_InitStruct.TriggerMode = LL_DMA_TRIGM_BLK_TRANSFER;
DMA_InitStruct.TriggerPolarity = LL_DMA_TRIG_POLARITY_MASKED;
DMA_InitStruct.TriggerSelection = 0x00000000U;
DMA_InitStruct.TransferEventMode = LL_DMA_TCEM_BLK_TRANSFER;
DMA_InitStruct.SrcAllocatedPort = LL_DMA_SRC_ALLOCATED_PORT0;
DMA_InitStruct.DestAllocatedPort = LL_DMA_DEST_ALLOCATED_PORT0;
DMA_InitStruct.LinkAllocatedPort = LL_DMA_LINK_ALLOCATED_PORT1;
DMA_InitStruct.LinkStepMode = LL_DMA_LSM_FULL_EXECUTION;
DMA_InitStruct.LinkedListBaseAddr = 0x00000000U;
DMA_InitStruct.LinkedListAddrOffset = 0x00000000U;
LL_DMA_Init(GPDMA1, LL_DMA_CHANNEL_0, &DMA_InitStruct);
|
LL_DMA_SetLinkedListBaseAddr(LL_GPDMA1_CH0, 0x00000000U);
LL_DMA_ConfigControl(LL_GPDMA1_CH0, LL_DMA_PRIORITY_LOW_WEIGHT_LOW
| LL_DMA_LINK_ALLOCATED_PORT1
| LL_DMA_LINKEDLIST_EXECUTION_Q);
LL_DMA_ConfigTransfer(LL_GPDMA1_CH0, LL_DMA_DEST_ALLOCATED_PORT0 | LL_DMA_DEST_ADDR_FIXED | LL_DMA_DEST_DATA_WIDTH_BYTE
| LL_DMA_SRC_ALLOCATED_PORT0 | LL_DMA_DEST_DATA_TRUNC_LEFT_PADD_ZERO | LL_DMA_SRC_ADDR_FIXED
| LL_DMA_SRC_DATA_WIDTH_BYTE);
/* ----- if DMA instance is GPDMA -------------------------------------------------*/
LL_DMA_ConfigBurstLength(LL_GPDMA1_CH0, 1, 1);
/* --------------------------------------------------------------------------------*/
LL_DMA_ConfigChannelTransfer(LL_GPDMA1_CH0, LL_DMA_DIRECT_XFER_EVENT_BLOCK | LL_DMA_TRIGGER_POLARITY_MASKED
| LL_DMA_HARDWARE_REQUEST_BURST | LL_DMA_DIRECTION_MEMORY_TO_MEMORY);
/* ----- case of direction is different of LL_DMA_DIRECTION_MEMORY_TO_MEMORY ------*/
LL_DMA_SetPeriphRequest(LL_GPDMA1_CH0, LL_DMA_HARDWARE_REQUEST_BURST);
/* --------------------------------------------------------------------------------*/
/* ----- case of direction is different of LL_DMA_TRIG_POLARITY_MASKED ------------*/
LL_DMA_SetHWTrigger(LL_GPDMA1_CH0, 0x00000000U);
LL_DMA_SetTriggerMode(LL_GPDMA1_CH0, LL_DMA_TRIGGER_BLOCK_TRANSFER);
/* --------------------------------------------------------------------------------*/
LL_DMA_SetBlkDataLength(LL_GPDMA1_CH0, 0x00000000U);
LL_DMA_ConfigAddresses(LL_GPDMA1_CH0, 0x00000000U, 0x00000000U);
LL_DMA_SetLinkedListAddrOffset(LL_GPDMA1_CH0, 0x00000000U);
|
LL_DMA_DeInit() API migration ¶
According to the used DMA channel, Implement the precise calls to
LL_AHB2_GRP1_ForceReset()
and
LL_AHB2_GRP1_ReleaseReset
Example: The application is using GPDMA1 instance
|
HAL1 |
HAL2 |
|---|---|
/* DeInit all GPDMA1 channels */
LL_DMA_DeInit(GPDMA1, LL_DMA_CHANNEL_ALL);
|
LL_AHB2_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPDMA1);
LL_AHB2_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPDMA1);
|
/* DeInit specific GPDMA1 channel */
LL_DMA_DeInit(GPDMA1, LL_DMA_CHANNEL_0);
|
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPDMA2);
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPDMA2);
|
LL_DMA_List_Init() API migration ¶
According to the use-case, implement the precise sequence call based on the LL static inline functions provided in
the
stm32tnxx_ll_dma.h
header file.
|
HAL1 |
HAL2 |
|---|---|
LL_DMA_InitLinkedListTypeDef DMA_InitLinkedListStruct = {0};
DMA_InitLinkedListStruct.Priority = LL_DMA_LOW_PRIORITY_HIGH_WEIGHT;
DMA_InitLinkedListStruct.LinkStepMode = LL_DMA_LSM_FULL_EXECUTION;
DMA_InitLinkedListStruct.LinkAllocatedPort = LL_DMA_LINK_ALLOCATED_PORT0;
DMA_InitLinkedListStruct.TransferEventMode = LL_DMA_TCEM_LAST_LLITEM_TRANSFER;
LL_DMA_List_Init(GPDMA1, LL_DMA_CHANNEL_0, &DMA_InitLinkedListStruct);
|
LL_DMA_ConfigControl(LL_GPDMA1_CH0, LL_DMA_LOW_PRIORITY_HIGH_WEIGHT
| LL_DMA_LSM_FULL_EXECUTION
| LL_DMA_LINK_ALLOCATED_PORT0);
LL_DMA_SetTransferEventMode(LL_GPDMA1_CH0, LL_DMA_LINKEDLIST_XFER_EVENT_Q);
|
LL_DMA_List_DeInit() API migration ¶
According to the used DMA channel, Implement the precise calls to
LL_AHB1_GRP1_ForceReset()
and
LL_AHB1_GRP1_ReleaseReset
Example: The application is using GPDMA1 instance
|
HAL1 |
HAL2 |
|---|---|
/* DeInit all GPDMA1 channels */
LL_DMA_DeInit(GPDMA1, LL_DMA_CHANNEL_ALL);
|
LL_AHB2_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPDMA1);
LL_AHB2_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPDMA1);
|
/* DeInit specific GPDMA1 channel */
LL_DMA_DeInit(GPDMA1, LL_DMA_CHANNEL_0);
|
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_GPDMA2);
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_GPDMA2);
|